package pl.edu.pw.polygen.modeler.client.workspace.listener;

import pl.edu.pw.polygen.modeler.client.object.IPolygenObject;
import pl.edu.pw.polygen.modeler.client.object.Vertex;
import pl.edu.pw.polygen.modeler.client.object.Vertex.VertexType;
import pl.edu.pw.polygen.modeler.client.workspace.IWorkspace;

import com.google.gwt.event.dom.client.MouseDownEvent;
import com.google.gwt.event.dom.client.MouseMoveEvent;
import com.google.gwt.event.dom.client.MouseUpEvent;
import com.google.gwt.event.dom.client.MouseWheelEvent;

public class VertexListener extends BaseWorkspaceListener {

	private IWorkspace workspace;
	private IPolygenObject vertex;
	
	public VertexListener(IWorkspace workspace){
		this.workspace = workspace;
	}
	
	@Override
	public void onMouseDown(MouseDownEvent event) {
		this.vertex = new Vertex(event.getX(),event.getY(),workspace,VertexType.NORMAL_VERTEX);
		vertex.add();
	}

	@Override
	public void onMouseUp(MouseUpEvent event) {
		this.vertex.drop();
		vertex.initialize();
	}
	

}
